In addition to launching applications, AppleScript applets, desk accessories, documents, etc. at predetermined times, Cron can also launch a special type of application called (for lack of a better name) a “cron command.” (Catchy, huh?) The unique thing about a Cron command is that it can accept arguments supplied along with the command in the crontab file which condition the way in which the command will behave. (Note that AppleScripts can be written to do the same thing. See the note in the “AppleScript Applets” subsection of the “READ ME” file for a link to details.)
Be aware that some commands included with past versions of cron aren’t included with this version, usually because they seemed hopelessly obsolete, pointless, or both. If a command on which you depended is missing from this distribution, you can just keep a copy of it around and use it with this new version of Cron. Also, please send me email to let me know that it was useful to you, and I’ll consider updating that command and including it in a future release.
OpenURL Open the Internet document (or whatever) referenced by a URL.
quit Quit an application.
rexec Issue an rexec command to a remote host.
shutdown Shutdown/restart the Macintosh.
sound Play a sound file.
"tcp time client" Get correct time from TCP-based Time server.
"udp time client" Get correct time from UDP-based Time server.
unmount Unmount (eject) a volume (disk).
uupc Run the UUPC program.
Activity Report
______________________________
Activity Report brings up a window on your screen into which you can type up to 255 characters of text. The text is recorded in a log file, along with the time and date at which each item of text was recorded. This can be helpful if you’re trying to track the use of your time.
-t Change prompt dialog timeout from default of 60 seconds, to the supplied number of seconds.
-l Use the following name for the log file, instead of the default ("Activity Log.txt").
-p Use the following string as the prompt in the activity dialog.
-w Use the following string as the window title for the activity dialog.
Examples:
activity-report
activity-report -t 90 -l "My Activity Log" -p "What's up doc?" -w "Nobody Expects the Spanish Inquisition"
Beep
______________________________
Beep simply causes the Mac emit the standard system beep once, or as many times as specified.
Usage:
beep [BeepCount]
Examples:
beep
beep 3
Cron Fader
______________________________
When used with the idlescreen extension to the crontab file format, Cron Fader allows Cron to work like a screen saver. In this case, the cron icon will jump randomly around all available screens, periodically spelling out the name “cron”. It will quit as soon as the mouse is moved, or a key is pressed.
Usage:
"cron fader"
Examples:
"cron fader"
Digest
______________________________
Generate MD4 digests of the specified files and record them in the “digest log.txt” file located in the same folder as the digest command. Any number of target files can be specified in place of TargetPathName in the example below. (Of course, it’s easiest to supply aliases to the files, instead of actual path names.)
Echo displays its arguments in Notification Manager alert windows. Those alerts automatically dismiss themselves after 60 seconds, unless the -t option is used to supply a longer or shorter delay period.
This command was originally contributed by Mike Pearce.
Usage:
echo [-t timeout] <args>...
Options:
-t Alert automatically goes away after the timeout interval (in seconds) has elapsed.
Examples:
echo "Time to go home and feed the dog."
echo -t 240 "The meeting starts soon, better leave now."
echo "Here's one message." "Here's another, separate message."
Midnight Sky Fader
______________________________
When used with the idlescreen extension to the crontab file format, Midnight Sky Fader allows Cron to work like a screen saver. In this case, various scenes composed of clouds and stars are rendered in great detail as if you were staring up into an ever changing night sky. It will quit as soon as the mouse is moved, or a key is pressed.
Note: Midnight Sky Fader requires at least a 68020 processor (Power PC preferred), System 7 and lots of RAM. It’s designed for rendering in 24-bit color (that’s the “Millions” color mode), but it will dither down to any lesser bit depth. The introductory screen will look terrible if you don’t have the Palatino TrueType font installed.
Usage:
"midnight sky fader"
Examples:
"midnight sky fader"
Modem
______________________________
The Modem command opens the modem port and writes a string to it. I sometimes use this command to have my office computer place wake-up calls to me at home. Whether it’s useful for anything else, I have no idea.
Usage:
modem [-p] String
Options:
-p Use the printer port instead of the modem port.
Examples:
modem "atdt 110-9123"
modem -p "atdt 110-9123"
MountAFP
______________________________
MountAFP logs-into and mounts AppleShare (AFP) volumes. The volume is specified by VolName on the file server name ServerName in the ZoneName zone. Log-in is performed with the UserName username and UserPassword password.
OpenURL uses Internet Config to open an appropriate Internet helper application (Anarchie, Fetch, Netscape, Explorer, etc.) and load the supplied URL(s). This is handy for having Cron open your favorite Internet publication and have it waiting for you when you arrive at the office.
Usage:
openurl <URL>...
Examples:
openurl "http://zcias4.ziff.com/~macweek/"
Quit
______________________________
The Quit command asks a running application to quit. The application may be specified by its name or its unique four letter creator code (AKA application signature, or autograph). Describing the methods for find application creator codes is beyond the scope of this document, so stick with application names if you aren’t already familiar with creator codes.
-c Use the following four letter creator code to identify the application that should be terminated.
-n Use the following name to identify the application that should be terminated.
Examples:
quit "Eudora"
quit CSOm
RExec
______________________________
RExec uses the UNIX rexec scheme to execute a command on a remote host (typically a UNIX host). The remote host is specified by HostName, your user name and password for the host should be specified in the UserName and Password arguments, and followed by an argument containing the command you want the remote host to execute.
Note: MacTCP is required, of course.
Usage:
rexec HostName UserName Password Command
Shutdown
______________________________
Shutdown quits all running applications and either restarts or shuts-down the Macintosh. It may do this interactively, such that a user working at the Mac at the time can cancel the shutdown, and it may optionally delete the desktop files on all mounted volumes in order to force them to be rebuilt when the computer starts-up again.
Note: When the desktop files are deleted, all the "Get Info" comments are lost for all files, even when running System 7.5.3 or better.
Note: Running applications that do not support AppleEvents will delay shutdown, since the OS will not kill them until the Quit event sent to them has timed-out. This can easily take a minute or two. Eventually, however, all processes will be killed and the restart/shutdown will take place. Fortunately, such applications are increasingly rare.
Usage:
shutdown [-rd] DelaySeconds [-i PromptString]
Options:
-r Restart the computer, instead of shutting it down.
-d Delete desktop files on all mounted volumes. This forces them to be rebuilt the next
time the volumes are mounted.
-i Shutdown interactively -- display a shutdown alert. PromptString should be specified
when this option is used.
Examples:
shutdown -ird 240 "Please prepare for nightly system restart..."
shutdown -i 60 "This Mac is about to turn itself off for the night."
shutdown 10
Sound
______________________________
Sound plays the 'snd ' resources specified by the SoundNames arguments. Sound will look for the 'snd ' resources in either the System file or in sound files of the same names. Any number of sound names may be specified -- each one will be played once and in the listed order.
Note: Sound may not work if it does not have enough memory in order to load the specified sound resource. Adjusting the Sound command’s memory allocation will fix this.
Usage:
sound SoundNames
Examples:
sound "Wild Eep" Sosumi Droplet
sound Quack
TCP Time Client
______________________________
Connect to the specified RFC 868 time server using TCP, get the time from it, and reset the Mac's time and date accordingly. Any number of time servers may be specified; each will be tried in turn until the time is successfully retrieved from one of them. Typically, you'll want to specify your local time server first, then one or two backup servers which should be tried if your local server is unavailable for some reason.
Note: This is a TCP-based implementation of the "Time Protocol" defined in RFC 868 of May 1983 (available via FTP from nis.nsf.net). While most time servers support both TCP and UDP based queries, there are exceptions. ULTRIX, for example, seems to be distributed with its support for TCP-based queries present, but disabled. Consequently, this command is useful with most, but not all, time servers.
Note: MacTCP is required (of course), and the Map control panel must be set to the correct local time zone for this command to do its job properly.
Usage:
"tcp time client" [-d] ServerName [BackupServerNames]
Options:
-d Automatically adjust for Daylight Savings Time (DST). Use this option if you live in an
area of the USA that observes the DST convention.
Examples:
"tcp time client" -d ntp1.utexas.edu ntp2.utexas.edu
UDP Time Client
______________________________
Connect to the specified RFC 868 time server using UDP, get the time from it, and reset the Mac's time and date accordingly. Any number of time servers may be specified; each will be tried in turn until the time is successfully retrieved from one of them. Typically, you'll want to specify your local time server first, then one or two backup servers which should be tried if your local server is unavailable for some reason.
Note: MacTCP is required (of course), and the Map control panel must be set to the correct local time zone for this command to do its job properly.
Usage:
"udp time client" [-d] ServerName [BackupServerNames]
Options:
-d Automatically adjust for Daylight Savings Time (DST). Use this option if you live in an
area of the USA that observes the DST convention.
Examples:
"tcp time client" -d ntp1.utexas.edu ntp2.utexas.edu
Unmount
______________________________
Unmount the volumes specified by VolumeName and all subsequent arguments. Volume names need not include a trailing colon.
Usage:
unmount VolumeName
Example:
unmount Staff
unmount "Virginia's Hard Disk"
UUPC
______________________________
The UUPC command instructs UUPC 3.0 to connect to the systems specified by SystemName and all subsequent parameters.
Usage:
uupc [-n applicationName] [-b] SystemName
Options:
-q Quit UUPC when the calls are complete.
-n Use the following name to identify the application that should be used to
connect to the specified systems.
-b Launch UUPC in the background, instead of the foreground.